#ifndef _LOGIC_ANIMATIONS_H_
#define _LOGIC_ANIMATIONS_H_

#include "PlatformTypes.h"
#include "LampManager.h"

/*
    High four bit : channel
    Low  four bit : lamp index
*/
extern uint8_t g_LeturnLampChannelMaps[32];

typedef struct LeFrntTurnLampFlickerAnimation
{
    uint16_t index;
    uint16_t maxFrame;
    uint8_t  pwm;
}LeFrntTurnLampFlickerAnimation;

extern struct LeFrntTurnLampFlickerAnimation g_LeFrntTurnLampFlickerAnimation;
extern void playLeFrntTurnLampFlickerAnimation(uint32_t* outputFrame, float* pwm);

typedef struct LeFrntTurnLampFlowAnimation
{
    uint16_t index;
    uint16_t maxFrame;
    uint8_t  pwm;
} LeFrntTurnLampFlowAnimation;
extern struct LeFrntTurnLampFlowAnimation g_LeFrntTurnLampFlowAnimation;
extern void playLeFrntTurnLampFlowAnimation(uint32_t* outputFrame, float* pwm);
extern void trenLeFrntTurnLampOff(uint32_t* outputFrame, float* pwm);

 //LeFrntTurnLamp ribbon unlock animation step a
 typedef struct LeFrntTurnLampRibbonUnlock_Step_a
 {
 #define LeFrntTurnLampRibbonUnlock_Step_a_MaxFrame 160
     uint16_t            index;
 } LeFrntTurnLampRibbonUnlock_Step_a;
 extern struct LeFrntTurnLampRibbonUnlock_Step_a g_LeFrntTurnLampRibbonUnlock_Step_a;
 extern void playLeFrntTurnLampRibbonUnlock_Step_a(void);
 extern bool isFinishLeFrntTurnLampRibbonUnlock_Step_a(void);
 extern void resetLeFrntTurnLampRibbonUnlock_Step_a(void);

 //LeFrntTurnLamp ribbon unlock animation step b
 typedef struct LeFrntTurnLampRibbonUnlock_Step_b
 {
 #define LeFrntTurnLampRibbonUnlock_Step_b_MaxFrame 40
     uint16_t index;
 } LeFrntTurnLampRibbonUnlock_Step_b;
 extern struct LeFrntTurnLampRibbonUnlock_Step_b g_LeFrntTurnLampRibbonUnlock_Step_b;
 extern void playLeFrntTurnLampRibbonUnlock_Step_b(void);
 extern bool isFinishLeFrntTurnLampRibbonUnlock_Step_b(void);
 extern void resetLeFrntTurnLampRibbonUnlock_Step_b(void);

 //LeFrntTurnLamp ribbon unlock animation step c
 typedef struct LeFrntTurnLampRibbonUnlock_Step_c
 {
 #define LeFrntTurnLampRibbonUnlock_Step_c_MaxFrame 400
     uint16_t index;
 } LeFrntTurnLampRibbonUnlock_Step_c;
 extern struct LeFrntTurnLampRibbonUnlock_Step_c g_LeFrntTurnLampRibbonUnlock_Step_c;
 extern void playLeFrntTurnLampRibbonUnlock_Step_c(void);
 extern bool isFinishLeFrntTurnLampRibbonUnlock_Step_c(void);
 extern void resetLeFrntTurnLampRibbonUnlock_Step_c(void);

 //Lobeam ribbon unlock animation step d1
 typedef struct LoBeamRibbonUnlock_Step_d_1
 {
 #define LoBeamRibbonUnlock_Step_d_1_MaxFrame 64
     uint16_t index;
 } LoBeamRibbonUnlock_Step_d_1;
 extern struct LoBeamRibbonUnlock_Step_d_1 g_LoBeamRibbonUnlock_Step_d_1;
 extern void playLoBeamRibbonUnlock_Step_d_1(void);
 extern bool isFinishLoBeamRibbonUnlock_Step_d_1(void);
 extern void resetLoBeamRibbonUnlock_Step_d_1(void);

 //Lobeam ribbon unlock animation step d2
 typedef struct LoBeamRibbonUnlock_Step_d_2
 {
 #define LoBeamRibbonUnlock_Step_d_2_MaxFrame 64
     uint16_t index;
 } LoBeamRibbonUnlock_Step_d_2;
 extern struct LoBeamRibbonUnlock_Step_d_2 g_LoBeamRibbonUnlock_Step_d_2;
 extern void playLoBeamRibbonUnlock_Step_d_2(void);
 extern bool isFinishLoBeamRibbonUnlock_Step_d_2(void);
 extern void resetLoBeamRibbonUnlock_Step_d_2(void);

 //Lobeam ribbon unlock animation step d3
 typedef struct LoBeamRibbonUnlock_Step_d_3
 {
 #define LoBeamRibbonUnlock_Step_d_3_MaxFrame 80
     uint16_t index;
 } LoBeamRibbonUnlock_Step_d_3;
 extern struct LoBeamRibbonUnlock_Step_d_3 g_LoBeamRibbonUnlock_Step_d_3;
 extern void playLoBeamRibbonUnlock_Step_d_3(void);
 extern bool isFinishLoBeamRibbonUnlock_Step_d_3(void);
 extern void resetLoBeamRibbonUnlock_Step_d_3(void);

 //Lobeam ribbon lock animation step d1
 typedef struct LoBeamLampRibbonLock_Step_c_1
 {
 #define LoBeamLampRibbonLock_Step_c_1MaxFrame 120
     uint16_t            index;
 } LoBeamLampRibbonLock_Step_c_1;
 extern struct LoBeamLampRibbonLock_Step_c_1 g_LoBeamLampRibbonLock_Step_c_1;
 extern void playLoBeamLampRibbonLock_Step_c_1(void);
 extern bool isFinishLoBeamLampRibbonLock_Step_c_1(void);
 extern void resetLoBeamLampRibbonLock_Step_c_1(void);

 //Lobeam ribbon lock animation step c2
 typedef struct LoBeamLampRibbonLock_Step_c_2
 {
 #define LoBeamLampRibbonLock_Step_c_2MaxFrame 120
     uint16_t            index;
 } LoBeamLampRibbonLock_Step_c_2;
 extern struct LoBeamLampRibbonLock_Step_c_2 g_LoBeamLampRibbonLock_Step_c_2;
 extern void playLoBeamLampRibbonLock_Step_c_2(void);
 extern bool isFinishLoBeamLampRibbonLock_Step_c_2(void);
 extern void resetLoBeamLampRibbonLock_Step_c_2(void);

 //LeFrntTurnLamp ribbon lock animation step d
 typedef struct LeFrntTurnLampRibbonLock_Step_d
 {
 #define LeFrntTurnLampRibbonLock_Step_dMaxFrame 296
     uint16_t            index;
 } LeFrntTurnLampRibbonLock_Step_d;
 extern struct LeFrntTurnLampRibbonLock_Step_d g_LeFrntTurnLampRibbonLock_Step_d;
 extern void playLeFrntTurnLampRibbonLock_Step_d(void);
 extern bool isFinishLeFrntTurnLampRibbonLock_Step_d(void);
 extern void resetLeFrntTurnLampRibbonLock_Step_d(void);

 //LeFrntTurnLamp ribbon lock animation step e
 typedef struct LeFrntTurnLampRibbonLock_Step_e
 {
 #define LeFrntTurnLampRibbonLock_Step_eMaxFrame 40
     uint16_t            index;
 } LeFrntTurnLampRibbonLock_Step_e;
 extern struct LeFrntTurnLampRibbonLock_Step_e g_LeFrntTurnLampRibbonLock_Step_e;
 extern void playLeFrntTurnLampRibbonLock_Step_e(void);
 extern bool isFinishLeFrntTurnLampRibbonLock_Step_e(void);
 extern void resetLeFrntTurnLampRibbonLock_Step_e(void);

 // Hangup Actions
 typedef struct HangupAction
 {
     uint16_t index;
     uint16_t maxFrame;
 } HangupAction;
 extern HangupAction g_RibbonHangup_160ms;
 extern void playRibbonHangup_160ms(void); //
 extern bool isFinishRibbonHangup_160ms(void); //
 extern void resetRibbonHangup_160ms(void); //
 extern HangupAction g_RibbonHangup_560ms;
 extern void playRibbonHangup_560ms(void); //
 extern bool isFinishRibbonHangup_560ms(void); //
 extern void resetRibbonHangup_560ms(void); //
 extern HangupAction g_RibbonHangup_800ms;
 extern void playRibbonHangup_800ms(void); //
 extern bool isFinishRibbonHangup_800ms(void); //
 extern void resetRibbonHangup_800ms(void); //
 extern HangupAction g_RibbonHangup_1000ms;
 extern void playRibbonHangup_1000ms(void); //
 extern bool isFinishRibbonHangup_1000ms(void); //
 extern void resetRibbonHangup_1000ms(void); //
 extern HangupAction g_RibbonHangup_1200ms;
 extern void playRibbonHangup_1200ms(void); //
 extern bool isFinishRibbonHangup_1200ms(void); //
 extern void resetRibbonHangup_1200ms(void); //
 extern HangupAction g_RibbonHangup_1680ms;
 extern void playRibbonHangup_1680ms(void); //
 extern bool isFinishRibbonHangup_1680ms(void); //
 extern void resetRibbonHangup_1680ms(void); //
 extern HangupAction g_RibbonHangup_4600ms;
 extern void playRibbonHangup_4600ms(void);
 extern bool isFinishRibbonHangup_4600ms(void);
 extern void resetRibbonHangup_4600ms(void);

 // Posn/LeFrntTurn lamp Ribbon Unlock Animation Manager
 typedef struct LeFrntTurnLampRibbonUnlockAnimationManager
 {
 #define LeFrntTurnLampRibbonUnlockMaxStemp 6
     uint8_t animationIndex_;
     bool    isAnimationFinish_;
     void (*animationFunctions[LeFrntTurnLampRibbonUnlockMaxStemp])();
     bool (*isAnimationFinishFunctions[LeFrntTurnLampRibbonUnlockMaxStemp])();
     void (*resetAnimationFunctions[LeFrntTurnLampRibbonUnlockMaxStemp])();
 } LeFrntTurnLampRibbonUnlockAnimationManager;
 extern LeFrntTurnLampRibbonUnlockAnimationManager g_LeFrntTurnLampRibbonUnlockAnimationManager;
 extern void initLeFrntTurnLampRibbonUnlockAnimationManager(void);
 extern void playLeFrntTurnLampRibbonUnlockAnimation(void);
 extern void repeatLeFrntTurnLampRibbonUnlockAnimation(void);
 extern bool isLeFrntTurnLampRibbonUnlockAnimationFinish(void);
 extern bool isLeFrntTurnLampRibbonUnlockAnimationPlaying(void);
 extern void resetLeFrntTurnLampRibbonUnlockAnimation(void);
 extern void justCloseRibbonLeFrntTurnLamp(void);

 // Lobeam lamp Ribbon Unlock Animation Manager
 typedef struct LobeamLampRibbonUnlockAnimationManager
 {
 #define LobeamLampRibbonUnlockMaxStemp 5
     uint8_t animationIndex_;
     bool    isAnimationFinish_;
     void (*animationFunctions[LobeamLampRibbonUnlockMaxStemp])();
     bool (*isAnimationFinishFunctions[LobeamLampRibbonUnlockMaxStemp])();
     void (*resetAnimationFunctions[LobeamLampRibbonUnlockMaxStemp])();
 } LobeamLampRibbonUnlockAnimationManager;
 extern LobeamLampRibbonUnlockAnimationManager g_LobeamLampRibbonUnlockAnimationManager;
 extern void initLobeamLampRibbonUnlockAnimationManager(void);
 extern void playLobeamLampRibbonUnlockAnimation(void);
 extern void repeatLobeamLampRibbonUnlockAnimation(void);
 extern bool isLobeamLampRibbonUnlockAnimationFinish(void);
 extern void resetLobeamLampRibbonUnlockAnimation(void);

 // Posn/LeFrntTurn lamp Ribbon lock Animation Manager
 typedef struct LeFrntTurnLampRibbonLockAnimationManager
 {
 #define LeFrntTurnLampRibbonLockMaxStemp 5
     uint8_t animationIndex_;
     bool    isAnimationFinish_;
     void (*animationFunctions[LeFrntTurnLampRibbonLockMaxStemp])();
     bool (*isAnimationFinishFunctions[LeFrntTurnLampRibbonLockMaxStemp])();
     void (*resetAnimationFunctions[LeFrntTurnLampRibbonLockMaxStemp])();
 } LeFrntTurnLampRibbonLockAnimationManager;
 extern LeFrntTurnLampRibbonLockAnimationManager g_LeFrntTurnLampRibbonLockAnimationManager;
 extern void initLeFrntTurnLampRibbonLockAnimationManager(void);
 extern void playLeFrntTurnLampRibbonLockAnimation(void);
 extern void repeatLeFrntTurnLampRibbonLockAnimation(void);
 extern bool isLeFrntTurnLampRibbonLockAnimationFinish(void);
 extern bool isLeFrntTurnLampRibbonLockAnimationPlaying(void);
 extern void resetLeFrntTurnLampRibbonLockAnimation(void);

 // Lobeam lamp Ribbon lock Animation Manager
 typedef struct LobeamLampRibbonLockAnimationManager
 {
 #define LobeamLampRibbonLockMaxStemp 4
     uint8_t animationIndex_;
     bool    isAnimationFinish_;
     void (*animationFunctions[LobeamLampRibbonLockMaxStemp])();
     bool (*isAnimationFinishFunctions[LobeamLampRibbonLockMaxStemp])();
     void (*resetAnimationFunctions[LobeamLampRibbonLockMaxStemp])();
 } LobeamLampRibbonLockAnimationManager;
 extern LobeamLampRibbonLockAnimationManager g_LobeamLampRibbonLockAnimationManager;
 extern void initLobeamLampRibbonLockAnimationManager(void);
 extern void playLobeamLampRibbonLockAnimation(void);
 extern void repeatLobeamLampRibbonLockAnimation(void);
 extern bool isLobeamLampRibbonLockAnimationFinish(void);
 extern void resetLobeamLampRibbonLockAnimation(void);


#endif
